package com.level.restful.service.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.level.restful.mapper.TBuyGoodsMapper;
import com.level.restful.entity.PageBean;
import com.level.restful.entity.TBuyGoods;
import com.level.restful.service.ITBuyGoodsService;
import com.level.restful.util.PageUtil;


@Service
public class TBuyGoodsServiceImpl extends ServiceImpl<TBuyGoodsMapper, TBuyGoods> implements ITBuyGoodsService {

	@Autowired
	private TBuyGoodsMapper buyMapper;
	
	@Override
	@Transactional(rollbackFor = Exception.class)
	public boolean buyGoods(TBuyGoods tBuyGoods) {
		int count = buyMapper.insert(tBuyGoods);
		if(count>0){
		}
		return true;
	}

	@Override
	public IPage<TBuyGoods> getList(PageBean bean) {
		Page page = PageUtil.pageDataInterchange(bean);
        Map<String,Object> map = bean.getCondition();
		return buyMapper.getList(page, map);
	}


}